/*
 Navicat Premium Dump SQL

 Source Server         : flink_cluster_monitor
 Source Server Type    : MySQL
 Source Server Version : 80024 (8.0.24)
 Source Host           : 10.1.1.26:3306
 Source Schema         : flink_cluster_monitor

 Target Server Type    : MySQL
 Target Server Version : 80024 (8.0.24)
 File Encoding         : 65001

 Date: 11/11/2025 14:35:37
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for service_config
-- ----------------------------
DROP TABLE IF EXISTS `service_config`;
CREATE TABLE `service_config` (
  `id` int NOT NULL AUTO_INCREMENT COMMENT '主键，自增ID',
  `service_type` varchar(50) NOT NULL COMMENT '服务类型：flink, kafka, redis, starrocks, mysql, api_listener 等',
  `config_name` varchar(100) NOT NULL COMMENT '配置名称，如：生产环境、测试环境、开发环境等',
  `host` varchar(255) DEFAULT NULL COMMENT '主机地址/IP',
  `port` int DEFAULT NULL COMMENT '端口号',
  `username` varchar(100) DEFAULT NULL COMMENT '用户名',
  `password` varchar(255) DEFAULT NULL COMMENT '密码',
  `database` varchar(100) DEFAULT NULL COMMENT '数据库名',
  `protocol` varchar(20) DEFAULT 'http' COMMENT '协议类型：http, https, tcp, ssl 等',
  `path` varchar(500) DEFAULT NULL COMMENT '路径，如：/api/v1, /jars 等',
  `api_url` varchar(500) DEFAULT NULL COMMENT 'API触发接口地址',
  `request_template` json DEFAULT NULL COMMENT 'API请求JSON模板',
  `kafka_topics` json DEFAULT NULL COMMENT 'Kafka监听主题配置，JSON格式',
  `variable_mapping` json DEFAULT NULL COMMENT '变量映射配置，用于参数替换',
  `execution_timeout` int DEFAULT '300' COMMENT 'API执行超时时间（秒）',
  `extra_config` json DEFAULT NULL COMMENT '额外配置，JSON格式存储其他参数',
  `description` varchar(255) DEFAULT NULL COMMENT '配置描述',
  `is_active` tinyint(1) DEFAULT '1' COMMENT '是否激活，1=激活，0=禁用',
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT '逻辑删除标记，0=未删除，1=已删除',
  `sort_order` int DEFAULT '0' COMMENT '排序顺序，数字越小越靠前',
  `created_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updated_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `deleted_time` timestamp NULL DEFAULT NULL COMMENT '删除时间',
  `created_by` varchar(50) DEFAULT 'system' COMMENT '创建者',
  `updated_by` varchar(50) DEFAULT 'system' COMMENT '更新者',
  `deleted_by` varchar(50) DEFAULT NULL COMMENT '删除者',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_service_type_config_name` (`service_type`,`config_name`,`is_deleted`),
  KEY `idx_service_type` (`service_type`),
  KEY `idx_config_name` (`config_name`),
  KEY `idx_is_active` (`is_active`),
  KEY `idx_is_deleted` (`is_deleted`),
  KEY `idx_sort_order` (`sort_order`),
  KEY `idx_api_url` (`api_url`),
  KEY `idx_service_type_active` (`service_type`,`is_active`,`is_deleted`)
) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='通用服务配置表（支持逻辑删除和API监听）';

-- ----------------------------
-- Records of service_config
-- ----------------------------
BEGIN;
INSERT INTO `service_config` (`id`, `service_type`, `config_name`, `host`, `port`, `username`, `password`, `database`, `protocol`, `path`, `api_url`, `request_template`, `kafka_topics`, `variable_mapping`, `execution_timeout`, `extra_config`, `description`, `is_active`, `is_deleted`, `sort_order`, `created_time`, `updated_time`, `deleted_time`, `created_by`, `updated_by`, `deleted_by`) VALUES (12, 'mysql', 'MYSQL(flink_cluster_monitor)', '10.1.1.26', 3306, 'root', 'nXhkTJYJ7D5rhGT5', 'flink_cluster_monitor', 'tcp', '/', NULL, NULL, NULL, NULL, 300, NULL, 'MySQL 默认环境', 1, 1, 1, '2025-09-21 14:24:07', '2025-09-30 17:29:20', '2025-09-30 17:29:20', 'web_ui', 'web_ui', 'web_ui');
INSERT INTO `service_config` (`id`, `service_type`, `config_name`, `host`, `port`, `username`, `password`, `database`, `protocol`, `path`, `api_url`, `request_template`, `kafka_topics`, `variable_mapping`, `execution_timeout`, `extra_config`, `description`, `is_active`, `is_deleted`, `sort_order`, `created_time`, `updated_time`, `deleted_time`, `created_by`, `updated_by`, `deleted_by`) VALUES (22, 'kafka', 'KAFKA生产环境(SASL)', '10.1.1.26', 9128, 'visitor', 'B8nbBCNPp3dz', '', 'SASL_PLAINTEXT', '/', NULL, NULL, NULL, NULL, 300, '{\"acks\": \"all\", \"retries\": 3, \"linger_ms\": 10, \"batch_size\": 16384, \"sasl_mechanism\": \"PLAIN\", \"compression_type\": \"gzip\", \"max_poll_records\": 1, \"auto_offset_reset\": \"latest\", \"bootstrap_servers\": [\"10.1.1.26:9128\"], \"security_protocol\": \"SASL_PLAINTEXT\", \"enable_auto_commit\": true, \"request_timeout_ms\": 60000, \"session_timeout_ms\": 30000, \"consumer_timeout_ms\": 10000}', 'Kafka SASL认证生产环境，从脚本kafka_consumer_forwarder.py提取', 1, 0, 1, '2025-09-22 11:33:21', '2025-09-22 11:33:21', NULL, 'system', 'system', NULL);
INSERT INTO `service_config` (`id`, `service_type`, `config_name`, `host`, `port`, `username`, `password`, `database`, `protocol`, `path`, `api_url`, `request_template`, `kafka_topics`, `variable_mapping`, `execution_timeout`, `extra_config`, `description`, `is_active`, `is_deleted`, `sort_order`, `created_time`, `updated_time`, `deleted_time`, `created_by`, `updated_by`, `deleted_by`) VALUES (50, 'api_listener', '爬虫队列接口', '10.1.1.26', 9128, 'visitor', 'B8nbBCNPp3dz', NULL, 'SASL_PLAINTEXT', NULL, 'http://10.1.1.26:7788/sadd_redis', '{\"seed_data\": [{\"video_id\": \"视频id\", \"prioritys\": 6, \"kafka_topic\": \"ods_dy_video_details_one\"}], \"queue_name\": \"ods_dy_video_details_one\"}', NULL, NULL, 300, NULL, '通用爬虫队列接口，用户可修改JSON模板适配不同业务', 1, 0, 1, '2025-09-22 11:33:21', '2025-09-22 11:33:21', NULL, 'system', 'system', NULL);
INSERT INTO `service_config` (`id`, `service_type`, `config_name`, `host`, `port`, `username`, `password`, `database`, `protocol`, `path`, `api_url`, `request_template`, `kafka_topics`, `variable_mapping`, `execution_timeout`, `extra_config`, `description`, `is_active`, `is_deleted`, `sort_order`, `created_time`, `updated_time`, `deleted_time`, `created_by`, `updated_by`, `deleted_by`) VALUES (51, 'redis', 'REDIS(test_19)', '10.1.1.19', 6379, '', 'mQFsv8jzorxI9yJN', '6', 'tcp', '/', NULL, NULL, NULL, NULL, 300, NULL, 'Redis生产环境DB7，从脚本export_dy_uid_to_redis.py提取，用于dy_uid映射', 1, 0, 1, '2025-09-24 17:51:13', '2025-11-11 14:01:22', NULL, 'web_ui', 'web_ui', NULL);
INSERT INTO `service_config` (`id`, `service_type`, `config_name`, `host`, `port`, `username`, `password`, `database`, `protocol`, `path`, `api_url`, `request_template`, `kafka_topics`, `variable_mapping`, `execution_timeout`, `extra_config`, `description`, `is_active`, `is_deleted`, `sort_order`, `created_time`, `updated_time`, `deleted_time`, `created_by`, `updated_by`, `deleted_by`) VALUES (54, 'mysql', 'MYSQL(flink_cluster_monitor)', '10.1.1.26', 3306, 'flink_cluster_monitor', 'nXhkTJYJ7D5rhGT5', 'flink_cluster_monitor', 'tcp', '/', NULL, NULL, NULL, NULL, 300, NULL, 'MySQL 默认环境', 1, 0, 1, '2025-09-30 17:29:20', '2025-09-30 17:29:20', NULL, 'web_ui', 'web_ui', NULL);
INSERT INTO `service_config` (`id`, `service_type`, `config_name`, `host`, `port`, `username`, `password`, `database`, `protocol`, `path`, `api_url`, `request_template`, `kafka_topics`, `variable_mapping`, `execution_timeout`, `extra_config`, `description`, `is_active`, `is_deleted`, `sort_order`, `created_time`, `updated_time`, `deleted_time`, `created_by`, `updated_by`, `deleted_by`) VALUES (56, 'starrocks', 'STARROCKS(72)', '10.1.1.72', 9030, 'zhangjie', 'X9DM4cW5&6@B', 'dws', 'tcp', '/', NULL, NULL, NULL, NULL, 300, NULL, 'Starrocks STARROCKS(72)配置', 1, 0, 0, '2025-09-30 17:42:59', '2025-09-30 17:42:59', NULL, 'web_ui', 'web_ui', NULL);
INSERT INTO `service_config` (`id`, `service_type`, `config_name`, `host`, `port`, `username`, `password`, `database`, `protocol`, `path`, `api_url`, `request_template`, `kafka_topics`, `variable_mapping`, `execution_timeout`, `extra_config`, `description`, `is_active`, `is_deleted`, `sort_order`, `created_time`, `updated_time`, `deleted_time`, `created_by`, `updated_by`, `deleted_by`) VALUES (57, 'starrocks', 'STARROCKS(65)', '10.1.1.65', 9030, 'zhangjie', 'X9DM4cW5&6@B', 'ods', 'tcp', '/', NULL, NULL, NULL, NULL, 300, NULL, 'StarRocks生产环境，从脚本export_dy_uid_to_redis.py提取，ODS数据层', 1, 0, 1, '2025-09-30 17:43:08', '2025-09-30 17:43:08', NULL, 'web_ui', 'web_ui', NULL);
INSERT INTO `service_config` (`id`, `service_type`, `config_name`, `host`, `port`, `username`, `password`, `database`, `protocol`, `path`, `api_url`, `request_template`, `kafka_topics`, `variable_mapping`, `execution_timeout`, `extra_config`, `description`, `is_active`, `is_deleted`, `sort_order`, `created_time`, `updated_time`, `deleted_time`, `created_by`, `updated_by`, `deleted_by`) VALUES (58, 'flink', 'FLINK(68)', '10.1.1.68', 8081, '', '', '', 'http', '/', NULL, NULL, NULL, NULL, 300, NULL, 'Flink 68环境', 1, 0, 1, '2025-11-10 09:19:53', '2025-11-10 09:19:53', NULL, 'web_ui', 'web_ui', NULL);
INSERT INTO `service_config` (`id`, `service_type`, `config_name`, `host`, `port`, `username`, `password`, `database`, `protocol`, `path`, `api_url`, `request_template`, `kafka_topics`, `variable_mapping`, `execution_timeout`, `extra_config`, `description`, `is_active`, `is_deleted`, `sort_order`, `created_time`, `updated_time`, `deleted_time`, `created_by`, `updated_by`, `deleted_by`) VALUES (64, 'flink', 'FLINK(26)', '10.1.1.26', 8081, '', '', '', 'http', '/', NULL, NULL, NULL, NULL, 300, NULL, 'Flink 26测试环境', 1, 0, 7, '2025-11-10 09:19:55', '2025-11-10 09:19:55', NULL, 'web_ui', 'web_ui', NULL);
INSERT INTO `service_config` (`id`, `service_type`, `config_name`, `host`, `port`, `username`, `password`, `database`, `protocol`, `path`, `api_url`, `request_template`, `kafka_topics`, `variable_mapping`, `execution_timeout`, `extra_config`, `description`, `is_active`, `is_deleted`, `sort_order`, `created_time`, `updated_time`, `deleted_time`, `created_by`, `updated_by`, `deleted_by`) VALUES (65, 'redis', 'REDIS(dev_69)', '10.1.1.69', 6379, '', 'mQFsv8jzorxI9yJN', '6', 'tcp', '/', NULL, NULL, NULL, NULL, 300, NULL, 'Redis生产环境DB7，从脚本export_dy_uid_to_redis.py提取，用于dy_uid映射', 1, 0, 1, '2025-09-24 17:51:13', '2025-11-11 14:01:29', NULL, 'web_ui', 'web_ui', NULL);
INSERT INTO `service_config` (`id`, `service_type`, `config_name`, `host`, `port`, `username`, `password`, `database`, `protocol`, `path`, `api_url`, `request_template`, `kafka_topics`, `variable_mapping`, `execution_timeout`, `extra_config`, `description`, `is_active`, `is_deleted`, `sort_order`, `created_time`, `updated_time`, `deleted_time`, `created_by`, `updated_by`, `deleted_by`) VALUES (66, 'redis', 'REDIS(spider_queue_26)', '10.1.1.26', 6379, '', 'mQFsv8jzorxI9yJN', '8', 'tcp', '/', NULL, NULL, NULL, NULL, 300, NULL, 'Redis生产环境DB7，从脚本export_dy_uid_to_redis.py提取，用于dy_uid映射', 1, 0, 1, '2025-09-24 17:51:13', '2025-11-11 14:01:33', NULL, 'web_ui', 'web_ui', NULL);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
